#ifndef UDPSOCKET_H
#define UDPSOCKET_H

//UDP socket communications

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <cstring>
#include <unistd.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <iostream>

#define MAX_MESSAGE 8192

//STATIC
class UDPSocket
{
    UDPSocket();

public:
    ~UDPSocket();

    static UDPSocket & instance();
    void Initial(const char *host, int port);

    int Receive(char *msg) ;
    int Send(const char *msg);

private:
    bool        mIsInitialOK;
    sockaddr_in mAddress;
    int mSockfd;

};

#endif // UDPSOCKET_H
